package com.huawei.appmarket.framework.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import com.huawei.appgallery.foundation.ui.css.CSSRule;
import com.huawei.appgallery.foundation.ui.css.CSSViewProxy;
import com.huawei.appgallery.foundation.ui.css.RenderListener;
import com.huawei.appgallery.foundation.ui.css.adapter.CSSPropertyName;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSMonoColor;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSValue;

public class CssImageView extends ImageView implements RenderListener {
    private b ˎ;

    interface b {
        void ˋ(boolean z);
    }

    public CssImageView(Context context) {
        super(context);
    }

    public CssImageView(Context context, @Nullable AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    public CssImageView(Context context, @Nullable AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
    }

    public boolean onRenderReady(CSSViewProxy cSSViewProxy) {
        if (this.ˎ != null) {
            CSSRule rule = cSSViewProxy.getRule();
            if (rule.getStyleDeclaration() == null) {
                this.ˎ.ˋ(false);
            } else {
                CSSValue propertyValue = rule.getStyleDeclaration().getPropertyValue(CSSPropertyName.BACKGROUND_TINT);
                if (propertyValue == null || !(propertyValue instanceof CSSMonoColor)) {
                    this.ˎ.ˋ(false);
                } else {
                    this.ˎ.ˋ(true);
                }
            }
        }
        return true;
    }

    public void setCssImageListener(b bVar) {
        this.ˎ = bVar;
    }
}
